package com.controller;

import com.annotation.FileName;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
@Controller
public class FileDownloadController {

    @GetMapping("/export")
    @FileName("花园宝宝正在直播")
    public byte[] export(){

        try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()){
            outputStream.write("我是玛卡巴卡".getBytes(StandardCharsets.UTF_8));
            return outputStream.toByteArray();
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }
}
